/**
 * 
 */
function goEdit(id){
	document.getElementsByName("id")[0].value=id;
	document.getElementsByName("flag")[0].value="edit";
	document.frmEditOrDelete.submit();
}
function goDelete(msg,id){
	if(confirm("确定要删除该"+msg+"？") == false){
		return;
	}
	document.getElementsByName("id")[0].value=id;
	document.getElementsByName("flag")[0].value="delete";
	document.frmEditOrDelete.submit();
}
function resetPwd(id){
	if(confirm("即将重置为默认密码，确定要重置读者密码？") == false){
		return;
	}
	document.getElementsByName("id")[0].value=id;
	document.getElementsByName("flag")[0].value="resetPwd";
	document.frmEditOrDelete.submit();
}
function goBorrow(id) {
	if (confirm("即将借阅，确定要借阅？") == false) {
		return;
	}
	document.getElementsByName("id")[0].value = id;
	document.getElementsByName("flag")[0].value = "borrow";
	document.frmEditOrDelete.submit();
}
function goReturn(id, isReturn, isExceed, fine, userType) {
	if(confirm("确定要还书？") == false){
		return;
	}
	if (userType==1) {
		if (isReturn==0 && isExceed==0) {
			if (confirm("书是否入库?") == false) {
				return;
			}
			document.getElementsByName("id")[0].value=id;
			document.getElementsByName("flag")[0].value="return";
			document.frmEditOrDelete.submit();
		}else if (isReturn==0 && isExceed==1) {
			if (confirm("有超期罚款" + fine + "角是否缴纳?") == false) {
				return;
			}
			if (confirm("书是否入库?") == false) {
				return;
			}
			document.getElementsByName("id")[0].value=id;
			document.getElementsByName("flag")[0].value="return";
			document.frmEditOrDelete.submit();
		}
	}else {
		if (confirm("是否确认还书?") == false) {
			return;
		}document.getElementsByName("id")[0].value=id;
		document.getElementsByName("flag")[0].value="return";
		document.frmEditOrDelete.submit();
	}
}

function goPostpone(id) {
	if (confirm("是否确认延期?") == false) {
		return;
	}
	document.getElementsByName("id")[0].value=id;
	document.getElementsByName("flag")[0].value="postpone";
	document.frmEditOrDelete.submit();
}

function goAdd(url){
	location.href=url+"/add.jsp";
}
function goSearch(pageNo){
	document.getElementsByName("pageNo")[0].value=pageNo;
	document.frmSearch.submit();
}
function goPre(){
	var pageNo =  parseInt(document.getElementsByName("pageNo")[0].value);
	if(pageNo <=1)
		return;
	pageNo --;
	goSearch(pageNo);
}
function goNext(max){
	var pageMax = parseInt(max);
	var pageNo =  parseInt(document.getElementsByName("pageNo")[0].value);
	//alert(pageNo);
	if(pageNo == pageMax)
		return;
	pageNo ++;
	goSearch(pageNo);
}
function doSearchBtn(){
	document.getElementsByName("pageNo")[0].value=1;
	document.frmSearch.submit();
}


